namespace B.S.Domain.Dto.AICustomerServiceDTO
{
    /// <summary>
    /// AI对话请求DTO
    /// </summary>
    public class AIConversationRequestDTO
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public string SessionId { get; set; } = string.Empty;

        /// <summary>
        /// 用户消息
        /// </summary>
        public string UserMessage { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID（可选）
        /// </summary>
        public int? UserId { get; set; }

        /// <summary>
        /// 用户名称（可选）
        /// </summary>
        public string? UserName { get; set; }

        /// <summary>
        /// 消息类型
        /// </summary>
        public string MessageType { get; set; } = "text";

        /// <summary>
        /// 客户端IP
        /// </summary>
        public string? ClientIP { get; set; }

        /// <summary>
        /// 设备信息
        /// </summary>
        public string? DeviceInfo { get; set; }
    }

    /// <summary>
    /// AI对话响应DTO
    /// </summary>
    public class AIConversationResponseDTO
    {
        /// <summary>
        /// 对话ID
        /// </summary>
        public int ConversationId { get; set; }

        /// <summary>
        /// 会话ID
        /// </summary>
        public string SessionId { get; set; } = string.Empty;

        /// <summary>
        /// AI回复消息
        /// </summary>
        public string AIResponse { get; set; } = string.Empty;

        /// <summary>
        /// 处理耗时（毫秒）
        /// </summary>
        public int ProcessingTime { get; set; }

        /// <summary>
        /// 问题分类
        /// </summary>
        public string? CategoryTag { get; set; }

        /// <summary>
        /// 相关推荐
        /// </summary>
        public List<string>? Suggestions { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
    }

    /// <summary>
    /// 对话历史查询DTO
    /// </summary>
    public class ConversationHistoryDTO
    {
        /// <summary>
        /// 对话ID
        /// </summary>
        public int ConversationId { get; set; }

        /// <summary>
        /// 会话ID
        /// </summary>
        public string SessionId { get; set; } = string.Empty;

        /// <summary>
        /// 用户消息
        /// </summary>
        public string UserMessage { get; set; } = string.Empty;

        /// <summary>
        /// AI回复
        /// </summary>
        public string AIResponse { get; set; } = string.Empty;

        /// <summary>
        /// 消息类型
        /// </summary>
        public string MessageType { get; set; } = string.Empty;

        /// <summary>
        /// 状态
        /// </summary>
        public string Status { get; set; } = string.Empty;

        /// <summary>
        /// 满意度评分
        /// </summary>
        public int? SatisfactionRating { get; set; }

        /// <summary>
        /// 是否已解决
        /// </summary>
        public bool IsResolved { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
    }

    /// <summary>
    /// 满意度评价DTO
    /// </summary>
    public class SatisfactionRatingDTO
    {
        /// <summary>
        /// 对话ID
        /// </summary>
        public int ConversationId { get; set; }

        /// <summary>
        /// 满意度评分（1-5）
        /// </summary>
        public int SatisfactionRating { get; set; }

        /// <summary>
        /// 用户反馈
        /// </summary>
        public string? UserFeedback { get; set; }

        /// <summary>
        /// 是否已解决问题
        /// </summary>
        public bool IsResolved { get; set; }
    }

    /// <summary>
    /// 数据查询结果DTO
    /// </summary>
    public class DataQueryResult
    {
        /// <summary>
        /// 是否查询成功
        /// </summary>
        public bool Success { get; set; } = true;

        /// <summary>
        /// 查询到的数据数量
        /// </summary>
        public int DataCount { get; set; } = 0;

        /// <summary>
        /// 格式化的回答文本
        /// </summary>
        public string Answer { get; set; } = string.Empty;

        /// <summary>
        /// 原始数据（JSON格式）
        /// </summary>
        public string? RawData { get; set; }

        /// <summary>
        /// 数据类型
        /// </summary>
        public string DataType { get; set; } = string.Empty;

        /// <summary>
        /// 查询关键词
        /// </summary>
        public List<string> Keywords { get; set; } = new();

        /// <summary>
        /// 相关建议
        /// </summary>
        public List<string>? Suggestions { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string? ErrorMessage { get; set; }
    }

    /// <summary>
    /// 关闭对话请求DTO
    /// </summary>
    public class CloseConversationRequestDTO
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public string SessionId { get; set; } = string.Empty;

        /// <summary>
        /// 关闭原因
        /// </summary>
        public string? CloseReason { get; set; }
    }
}
